#include <stdio.h>

int factorial(int num)
{
    int fact = 1;
    while (num)
    {
        fact *= num;
        num--;
    }
    return fact;
}

int factorialSum(int num)
{
    int sum = 0;
    for (int idx = 1; idx <= num; idx++)
    {
        sum += factorial(idx);
    }
    return sum;
}

int main()
{
    int num = 0;
    scanf("%d", &num);
    printf("%d\n", factorialSum(num));
}